<?php
/**
 * Returns a formatted html string for author including website link if any
 *
 * @param  string   $name
 * @param  string   $site
 * @param  boolean  $nofollow
 * @return string
 */
function format_comment_author($name, $site=null, $nofollow=true)
{
  if (!is_null($site) && preg_match('/^http/i', $site))
  {
    return sprintf('<a href="%s"%s>%s</a>',
                   $site,
                   $nofollow === true ? ' rel="nofollow"' : '',
                   $name);
  }
  else
  {
    return $name;
  }
}
